<?php use_helper('Javascript','Form')?>

<?php if($contactForm->isNew()):?>
  <?php    
    $save_url = 'contact/insertSupplier';
    $reset_url = 'contact/createSupplier';
  ?>
<?php else:?>
  <?php    
    $save_url = 'contact/updateSupplier';
    $reset_url = 'contact/editSupplier';
  ?>
<?php endif;?>

<?php echo form_tag($save_url); ?>
<table>
  <tr>
    <td colspan="2">
      <?php if((! $contactForm->isValid())&&($contactForm->isBound())):?>
        <ul class="error_list"><li>Errors on form (Contact)</ul>
        <?php echo $contactForm->renderGlobalErrors()?>
      <?php endif;?>
      <?php if((! $accountSupplierForm->isValid())&&($accountSupplierForm->isBound())):?>
        <ul class="error_list"><li>Errors on form (Supplier Data)</ul>
        <?php echo $accountSupplierForm->renderGlobalErrors()?>
      <?php endif;?>
    </td>
  </tr>
  <tr>
    <td>
      <div class="infobox1">
        <?php include_partial('contact_fields',array('contactForm'=>$contactForm,))?>
      </div>
    </td>
    <td>
      <div class="infobox1">
        <div class="separator">Supplier Info</div>
        <?php include_partial('supplier_fields',array('accountSupplierForm'=>$accountSupplierForm,))?>
      </div>
    </td>
  </tr>
</table>
<?php 
  include_partial(
    'save_buttons',
    array(
      'save_url'=>$save_url,
      'delete_url'=>'contact/deleteSupplier',
      'reset_url'=>$reset_url,
      'form_type'=>'supplier',
      'list_name'=>$contactForm->getObject()->getListName(),
      'new'=>$contactForm->isNew(),
      'update'=>'contactBox',
      'contact_row'=>'row_contact_'.$iden,
      'update_url'=>'contact/getSupplierColumn?iden='.$iden,
    )
  )
?>
</form>
